<{include file='public/head'}>
<div class="layui-body">
	<{if condition="$list"}>
	<div class="layui-tab layui-tab-brief" lay-filter="tab">
	  <ul class="layui-tab-title">
	    <li class="layui-this" lay-id="t1">模型列表</li>
	    <li lay-id="t2">模型新增</li>
	  </ul>
	  <div class="layui-tab-content">
	  	   <div class="layui-tab-item layui-show">
		   <form class="layui-form" method="post" id="contentForm" name="contentForm">
	  	   		 <table class="layui-table">
	            	<thead>
	                    <tr>
							<th><input type="checkbox" class="checkbox" lay-ignore id="checkall" title="全选"></th>
	                    	<th>序号</th>
	                        <th>名称</th>
	                        <th>类型</th>
	                        <th>URL名称</th>
	                        <th>列表页模板</th>
	                        <th>详情页模板</th>
							 <th>排序</th>
	                        <th>状态</th>
	                        <th>操作</th>
	                    </tr>
	                </thead>
	                <tbody>
						<{volist name="models" id="val"}>
	                    <tr>
						<td>
								<input type="checkbox" class="checkbox checkitem" lay-ignore name="Del[]" value="<{$val.id}>">
		                    	<input type="hidden" name="listall[]" value="<{$val.id}>">
							</td>
							<td><{$i}></td>
	                        <td><{$val.name}></td>
	                        <td>
								<{if condition="$val.type eq 1"}>单页<{/if}>
	                        	<{if condition="$val.type eq 2"}>新闻列表<{/if}>
								<{if condition="$val.type eq 3"}>图片列表<{/if}>
							</td>
							<td><{$val.urlname}></td>
	                        <td><{$val.listtpl}></td>
	                        <td><{$val.contenttpl}></td>
							<td class="table-input">
								<input type="text" lay-ignore class="layui-input" name="sorting[<{$val.id}>]" value="<{$val.sorting}>">
							</td>
	                        <td>
	                            <{if condition="$val.status"}>
	                            <a href="<{:url('mod',array('id'=>$val['id']))}>/field/status/value/0">
								
								<i class='fa fa-toggle-on' title="点击禁用"></i></a>
	                            <{else}>
	                             <a href="<{:url('mod',array('id'=>$val['id']))}>/field/status/value/1"><i class='fa fa-toggle-off' title="点击启用"></i></a>
	                            <{/if}>
	                        </td>
	                        <td>
	                        	<{if(!$val.issystem)}>
	                            	<{:get_btn_del($val.id,'Modelm')}>
	                            <{/if}>
	                            <{:get_btn_mod($val.id,'Modelm')}>
	                        </td>
	                    </tr>
						<{/volist}>
	                </tbody>
	            </table>
				<button type="submit" name="submit" onclick="return setSortAction();" value="sorting" class="layui-btn">保存排序</button>
				 <script>
					function setSortAction(){
						document.contentForm.action = "<{:url('sort')}>";
						return confirm("您确定要进行排序？");
					}
				</script>
	            <div class="page"><{$models->render()}></div>
				</form>
	  	   </div>
	  	   
	  	   <div class="layui-tab-item">
	  	   		<form action="<{:url('/Modelm/addsave')}>" method="post" class="layui-form">
	                <input type="hidden" name="formcheck" value="<{$formcheck}>" > 
	                <div class="layui-form-item">
	                     <label class="layui-form-label">模型名称  <span class="layui-text-red">*</span></label>
	                     <div class="layui-input-block">
	                     	<input type="text" name="name" required lay-verify="required" placeholder="请输入模型名称" class="layui-input">
	                     </div>
	                </div>
	                
	                 <div class="layui-form-item">
	                     <label class="layui-form-label">模型类型  <span class="layui-text-red">*</span></label>
	                     <div class="layui-input-block">
	                     	 <select name="type" lay-verify="required">
		                     	<option value="">请选择模型类型</option>
		                        <option value="1">单页</option>
		                        <option value="2">新闻列表</option>
								<option value="3">图片列表</option>
		                    </select>
	                     </div>
	                </div>
	                
	                <div class="layui-form-item">
	                     <label class="layui-form-label">URL名称 </label>
	                     <div class="layui-input-block">
	                     	<input type="text" name="urlname"  placeholder="请输入URL地址名称，如：news" class="layui-input">
	                     </div>
	                </div>
	                
	                <div class="layui-form-item">
	                     <label class="layui-form-label">列表页模板</label>
	                     <div class="layui-input-block">
	                     	<input type="text" name="listtpl" placeholder="请输入列表页模板" class="layui-input">
	                     </div>
	                </div>
	                
	                <div class="layui-form-item">
	                     <label class="layui-form-label">详情页模板</label>
	                     <div class="layui-input-block">
	                     	<input type="text" name="contenttpl" placeholder="请输入详情页模板" class="layui-input">
	                     </div>
	                </div>
	                
	                <div class="layui-form-item">
	                     <label class="layui-form-label">状态</label>
	                     <div class="layui-input-block">
	                     	<input type="radio" name="status" value="1" title="启用" checked>
							<input type="radio" name="status" value="0" title="禁用">
	                     </div>
	                </div>
	  	   		
	  	   			<div class="layui-form-item">
						 <div class="layui-input-block">
						    <button class="layui-btn" lay-submit>立即提交</button>
						    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
						 </div>
					</div>

	  	   		</form>
	  	   </div>
	  </div>
	</div>
	<{/if}>
	<{if condition="$modedit && $model"}>
	<div class="layui-tab layui-tab-brief" lay-filter="tab">
	  <ul class="layui-tab-title">
	    <li class="layui-this">模型修改</li>
	  </ul>
	  <div class="layui-tab-content">
	  	<div class="layui-tab-item layui-show">
	  		<form action="<{:url('/Modelm/mod',array('id'=>$UrlParam.id))}>" method="post" class="layui-form">
	  			<input type="hidden" name="formcheck" value="<{$formcheck}>" > 
	  			<div class="layui-form-item">
                     <label class="layui-form-label">模型名称 <span class="layui-text-red">*</span></label>
                     <div class="layui-input-block">
                     	<input type="text" name="name" required lay-verify="required" value="<{$model.name}>" placeholder="请输入模型名称" class="layui-input">
                     </div>
                </div>
                
                 <div class="layui-form-item">
                     <label class="layui-form-label">模型类型  <span class="layui-text-red">*</span></label>
                     <div class="layui-input-block">
                     	 <select name="type" lay-verify="required">
	                     	<option value="">请选择模型类型</option>
	                        <option value="1" <{if condition="$model.type eq 1"}>selected<{/if}>>单页</option>
	                        <option value="2" <{if condition="$model.type eq 2"}>selected<{/if}>>新闻列表</option>
							<option value="3" <{if condition="$model.type eq 3"}>selected<{/if}>>图片列表</option>
	                    </select>
                     </div>
                </div>
                
                <div class="layui-form-item">
                     <label class="layui-form-label">URL名称</label>
                     <div class="layui-input-block">
                     	<input type="text" name="urlname" value="<{$model.urlname}>" placeholder="请输入URL地址名称，如：news" class="layui-input">
                     </div>
                </div>
                
                <div class="layui-form-item">
                     <label class="layui-form-label">列表页模板</label>
                     <div class="layui-input-block">
                     	<input type="text" name="listtpl" value="<{$model.listtpl}>" placeholder="请输入列表页模板" class="layui-input">
                     </div>
                </div>
                
                <div class="layui-form-item">
                     <label class="layui-form-label">详情页模板</label>
                     <div class="layui-input-block">
                     	<input type="text" name="contenttpl"  value="<{$model.contenttpl}>" placeholder="请输入详情页模板" class="layui-input">
                     </div>
                </div>
                
                <div class="layui-form-item">
                     <label class="layui-form-label">状态</label>
                     <div class="layui-input-block">
                     	<input type="radio" name="status" value="1" title="启用" <{if condition="$model.status eq 1"}>checked<{/if}>>
						<input type="radio" name="status" value="0" title="禁用" <{if condition="$model.status eq 0"}>checked<{/if}>>
                     </div>
                </div>
  	   		
  	   			<div class="layui-form-item">
					 <div class="layui-input-block">
					    <button class="layui-btn" lay-submit>立即提交</button>
					    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
					    <{:get_btn_back('Modelm')}>
					 </div>
				</div>	
	  		</form>
	  	</div>
	  </div>
	 </div>
	<{/if}>
</div>
<{include file='public/foot'}>